home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / AltiVec Effect / Effect.r < prev    next >
Encoding:
Text File  |  1999-06-24  |  7.8 KB  |  268 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        Effect.r
  3.  
  4.     Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  5.  
  6. */
  7.  
  8. #define UseExtendedThingResource 1
  9.  
  10. #include "Components.r"
  11. #include "ImageCodec.r"
  12. #include "MacTypes.r"
  13. #include "Icons.r"
  14.  
  15. #include "EffectDefinitions.h"
  16.  
  17. #if    TARGET_OS_WIN32
  18.     #define Target_PlatformType      platformWin32
  19. #endif
  20.  
  21.  
  22. #define effectCodecInfo            "AltiVec Effect CodecInfo"
  23.  
  24. #define    effectCodecFormatName    "AltiVec Effect"
  25.  
  26. #define    effectCodecFormatType    'AvFx'
  27.  
  28. #define DecoFlags        (codecInfoDoes32 + codecInfoDoes16 + codecInfoDoes8 + codecInfoDoes4 + codecInfoDoes2 + codecInfoDoes1 + codecInfoDoesSpool  + codecInfoHasEffectParameterList)
  29. #define DataFormatFlags    (codecInfoDepth1 + codecInfoDepth2 + codecInfoDepth4 + codecInfoDepth8 + codecInfoDepth16 + codecInfoDepth32 + codecInfoDepth33 + codecInfoDepth34 + codecInfoDepth36 + codecInfoDepth40 + codecInfoDoesLossless)
  30.  
  31. /*
  32.  
  33.     This structure defines the capabilities of the codec. 
  34.     
  35. */
  36. resource 'cdci' (kEffectcdciRes, effectCodecInfo, locked) {
  37.     effectCodecFormatName,                            /* name of the codec TYPE ( data format ) */
  38.     1,                                                /* version */                            
  39.     1,                                                /* revision */    
  40.     'BuNa',                                            /* who made this codec */
  41.     DecoFlags,                                        /* depth and etc. supported directly on decompress */    
  42.     0,                                                /* depth and etc supported directly on compress */
  43.     DataFormatFlags,                                /* which data formats do we understand */
  44.     100,                                            /* compress accuracy (0-255) (relative to format) */
  45.     100,                                            /* decompress accuracy (0-255) (relative to format) */
  46.     100,                                            /* millisecs to compress 320x240 image on base Mac */
  47.     100,                                            /* millisecs to decompress 320x240 image on base Mac */
  48.     100,                                            /* compression level (0-255) (relative to format) */
  49.     0,                                
  50.     2,                                                /* minimum height */
  51.     2,                                                /* minimum width */
  52.     0,
  53.     0,
  54.     0
  55. };
  56.  
  57. // ====================================================================================
  58. // The Thing resources
  59. // ====================================================================================
  60.  
  61. resource 'thng' (kEffectthngRes, "AltiVec Effect", locked) {
  62.     decompressorComponentType,                        // Type: always 'imdc' for effects
  63.     effectCodecFormatType,                            // SubType: the effect algorithm being implemented
  64.     'BuNa',                                            // Manufacturer
  65.     
  66.     // The flags depend on the type of resource being built
  67. #if    TARGET_REZ_MAC_68K
  68.     DecoFlags,                                        // Flags
  69.     0,                                                // Flags Mask
  70.     'imdc', kEffectthngRes,                            // Code resource
  71. #else
  72.     0, 0,                                            // Flags, Mask
  73.     0, 0,                                            // Code resource
  74. #endif
  75.     'STR ',    kEffectNameRes,                            // Name
  76.     'STR ',    kEffectDescriptionRes,                    // Info
  77.     'ICON',    kEffectICONRes,                            // Icon
  78.     kDimmerEffectVersion,                            // Version
  79.     
  80. #if !TARGET_REZ_MAC_68K
  81.     componentHasMultiplePlatforms + 
  82. #endif
  83.         componentDoAutoVersion,
  84.     0,                                                // Icon Family
  85.     {
  86. #if    TARGET_OS_MAC
  87.   #if TARGET_REZ_MAC_PPC
  88.          DecoFlags, 
  89.         'imdc',    kEffectthngRes,                        // Code
  90.         platformPowerPC,
  91.   #endif
  92. #else
  93.         DecoFlags,                
  94.         'dlle',    kEffectthngRes,                        // Code
  95.         Target_PlatformType,
  96. #endif
  97.     },
  98. };
  99.  
  100.  
  101. // ====================================================================================
  102. // The component's icon
  103. // ====================================================================================
  104.  
  105. resource 'ICON' (kEffectICONRes, purgeable) {
  106.     $"0200 0F80 03FF FF80 0C00 0FE0 0FFF FFE0"
  107.     $"0180 1F00 0100 0F00 0100 0F00 0300 0F80"
  108.     $"0008 6000 0018 7000 007F FC00 00C0 1E00"
  109.     $"0004 C000 0004 C000 0004 C000 0007 C000"
  110.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  111.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  112.     $"0004 C000 0004 C000 0004 C000 0004 C000"
  113.     $"0003 8000 0004 C000 0004 C000 0004 C000"
  114. };
  115.  
  116.  
  117. // ====================================================================================
  118. // Name and description strings
  119. // ====================================================================================
  120.  
  121. resource 'STR ' (kEffectNameRes) {
  122.     "AltiVec Effect"
  123. };
  124.  
  125. resource 'STR ' (kEffectDescriptionRes) {
  126.     "Varies the image integrity"
  127. };
  128.  
  129. // ====================================================================================
  130. // The parameter descriptions
  131. // You must change these to reflect the paramaters that your effect takes.
  132. // Each effect has a set of standard resources that must be present.
  133. // A set of optional resources is required for each parameter your effect has.
  134. // ====================================================================================
  135.  
  136. resource 'atms' (kEffectatmsRes) {
  137. 8 + 5,        // number of root atoms
  138. {
  139.     // ---------------------------------------
  140.     // The Standard Resources
  141.     // These must be present - they describe
  142.     // your effect
  143.     // ---------------------------------------
  144.     
  145.     // The name of the parameters
  146.     kParameterTitleName, kParameterTitleID, noChildren,
  147.     {
  148.         string { "AltiVec Effect Parameters" };
  149.     };
  150.     
  151.     // The name (subType) of the effect component
  152.     kParameterWhatName, kParameterWhatID, noChildren,
  153.     {
  154.         OSType { "AvFx" };
  155.     };
  156.  
  157.     // The maximum number of sources the effect takes
  158.     kParameterSourceCountName, kParameterSourceCountID, noChildren,
  159.     {
  160.         long { "1" };
  161.     };
  162.     
  163.     // If this codec can't be found, try this other one as a replacement
  164.     kParameterAlternateCodecName, kParameterAlternateCodecID, noChildren,
  165.     {
  166.         OSType { "dslv" };
  167.     };
  168.     
  169.     // Information atoms
  170.     kParameterInfoLongName, kParameterInfoIDs, noChildren,
  171.     {
  172.         string { "AltiVec Effect" };
  173.     };
  174.     
  175.     kParameterInfoCopyright, kParameterInfoIDs, noChildren,
  176.     {
  177.         string { "Copyright © 1999, Buena Software" };
  178.     };
  179.     
  180.     kParameterInfoDescription, kParameterInfoIDs, noChildren,
  181.     {
  182.         string { "Varies the source integrity" };
  183.     };
  184.     
  185.     kParameterInfoWindowTitle, kParameterInfoIDs, noChildren,
  186.     {
  187.         string { "AltiVec Effect Information…" };
  188.     };
  189.     
  190.     // ---------------------------------------
  191.     // Optional Resources
  192.     // There is a standard set of resources
  193.     // for each parameter your effect takes.
  194.     // See the QT3.0
  195.     // SDK chapter on effects for descriptions
  196.     // of the resources you must supply for
  197.     // your effect
  198.     // ---------------------------------------
  199.  
  200.     // The percentage parameter defines the starting and end
  201.     // point of the effect. For example, instead of fading down
  202.     // from full intensity to black, then up again, you could
  203.     // fade down from a medium intensity, then back up to full
  204.     // intensity by specifying a starting percentage of 25% and
  205.     // an ending percentage of 100%
  206.     
  207.     // The general information about the parameter
  208.     kParameterAtomTypeAndID, 1, noChildren,
  209.     {
  210.         OSType { "SrIn" };                // The parameter code
  211.         long { "1" };                    // The parameter ID
  212.         kAtomNotInterpolated;                    // Parameter flags
  213.         string { "Source Integrity" };        // The parameter name
  214.     };
  215.     
  216.     // The data type of the parameter
  217.     kParameterDataType, 1, noChildren,
  218.     {
  219.         kParameterTypeDataLong;
  220.     };
  221.     
  222.     // The range of values the parameter can take            
  223.     kParameterDataRange, 1, noChildren,
  224.     {
  225.         long { "2" };            // Minimum value
  226.         long { "15" };        // Maximum value
  227.         long { "1" };        // Scale. This value will scale the value set
  228.                                 // by the user into the range 0…100
  229.         long { "0" };            // Precision
  230.     };
  231.  
  232.     // The parameter's "behavior"
  233.     kParameterDataBehavior, 1, noChildren,
  234.     {
  235.         kParameterItemControl;    // Display this item using a control. In the case
  236.                                 // of a parameter of data type Fixed, this will result
  237.                                 // (in the standard parameters dialog box) in a slider
  238.                                 // being displayed which the user can use to set the
  239.                                 // value of the parameter.
  240.         long { "0" };            // Flags
  241.     };
  242.  
  243.     // The default value for the parameter. In this case this
  244.     // is a tween record    
  245.     kParameterDataDefaultItem, 1, noChildren,
  246.     {
  247.         long { "5" };
  248.     };
  249.         // The tween record
  250. };
  251. };
  252.  
  253. #ifndef MW_REZ
  254.  
  255. #if    TARGET_OS_MAC
  256.     #if TARGET_REZ_MAC_PPC
  257.         read 'imdc' (kEffectthngRes, "AltiVec Effect") $$Shell("RsrcDir")"AltiVecPPC.pef";
  258.     #else
  259.         Include $$Shell("RsrcDir")"AltiVecEffect.rsrc" 'proc' (0) as 'imdc' ( kEffectthngRes, "AltiVec Effect" );
  260.     #endif
  261. #else
  262.     resource 'dlle' (kEffectthngRes) {
  263.         "EffectsFrameComponentDispatch"
  264.     };
  265. #endif
  266.  
  267. #endif // MW_REZ
  268.